package com.mqtt.ctwingmqtt.controller;

import com.mqtt.ctwingmqtt.domain.entity.NbHouseholdValvesHistory;
import com.mqtt.ctwingmqtt.service.NbHouseholdValvesHistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/nbhistory")
public class NBHouseholdValvesHistoryController {

    @Autowired
    private NbHouseholdValvesHistoryService nbHouseholdValvesHistoryService;

    /**
     * 根据设备地址查询设备历史记录
     * @param deviceAddress
     * @return
     */
    @GetMapping("/valvesfind")
    public List<NbHouseholdValvesHistory> getNBHouseholdValvesHistoryByDeviceAddress(@RequestParam String deviceAddress) {
        return nbHouseholdValvesHistoryService.findByDeviceAddress(deviceAddress);
    }
}